const Generator = require('yeoman-generator');

module.exports = class extends Generator {
    prompting() {
        return this.prompt([
            {
                type: 'input',
                name: 'name',
                message: 'Your project name',
                default: this.appname // 默认为项目生成目录名称
            }
        ]).then(answers => {
            // answers 为 {name: 用户输入的name， 若美没有输入默认为项目生成目录名称}
            this.answers = answers
        })
    }

    writing() {
        const templ = this.templatePath('template.html')
        const output = this.destinationPath('cli.html')
        const content = this.answers

        this.fs.copyTpl(templ, output, content)
    }
}